package stu.day39_day.day39;

public class hw1 {
    public int fib(int n) {
        int first = 0;
        int second = 1;
        if(n==0){
            return first;
        }
        if(n==1){
            return second;
        }
        for (int i=2;i<n;i++){
            int num = second;
            second = first+second;
            first = num;
        }
        return first+second;
    }


    public int climbStairs(int n) {
        int first = 1;
        int second = 2;

        if(n==1){
            return first;
        }
        if(n==2){
            return second;
        }
        for (int i=3;i<n;i++){
            int num = second;
            second = first+second;
            first = num;
        }
        return first+second;

    }
}
